package handler

import (
	"github.com/gin-gonic/gin"
	request2 "zg3yk/api/request"
	"zg3yk/interface/dao"
	"zg3yk/interface/models"
)

func VideoShow(context *gin.Context) {

	var video []models.Videos

	dao.FindList(&models.Videos{}, &video)

	context.JSON(200, gin.H{
		"code": 200,
		"msg":  "展示",
		"data": video,
	})

}

func VideoSearch(context *gin.Context) {
	var req request2.Videos
	err := context.ShouldBind(&req)
	if err != nil {
		context.JSON(500, gin.H{
			"code": 500,
			"msg":  err.Error(),
			"data": nil,
		})
		return
	}
	var video models.Videos

	dao.FindSearch(req.Videoname, &video)

	context.JSON(200, gin.H{
		"code": 200,
		"msg":  "展示",
		"data": video,
	})

}
